<div class="page-header">
	<h1 style="display: inline;">
		<?php echo $survey['Survey']['name']; ?>
	</h1>
	<div class="pull-right">
		<?php echo $this->TwitterBootstrap->button_link("Edit this Survey", array('controller' => "Surveys", 'action' => "edit", $survey['Survey']['id']), array('style' => 'warning')); ?>
		<?php echo $this->TwitterBootstrap->button_form("Delete this Survey", array('controller' => "Surveys", 'action' => "delete", $survey['Survey']['id']), array('style' => 'danger'), "Are you sure you wish to delete this Survey and all its data?\\r\\n\\r\\nThis action cannot be undone."); ?>
	</div>
</div>

<h2>Survey Details</h2>
<div class="row">
	<div class="span12">
		<dl class="dl-horizontal">
			<dt>Created</dt>
			<dd>
				<?php echo $this->Time->nice($survey['Survey']['created']); ?>
				(<?php echo $this->Time->timeAgoInWords($survey['Survey']['created']); ?>)
			</dd>

			<dt>Closes</dt>
			<dd>
				<?php echo $this->Time->nice($survey['Survey']['closes']); ?>
				(<?php echo $this->Time->timeAgoInWords($survey['Survey']['closes']); ?>)
			</dd>

			<dt>Link</dt>
			<dd>
				<a href="<?php echo $this->Html->url(array('controller' => 'SurveyResponses', 'action' => 'submit', $survey['Survey']['identifier']), true); ?>"><?php echo $this->Html->url(array('controller' => 'SurveyResponses', 'action' => 'submit', $survey['Survey']['identifier']), true); ?></a>
			</dd>
		</dl>
	</div>
</div>

<h2><?php echo sprintf("%d Survey %s", count($survey['Question']), $this->Pluralization->smartPluralize("Question", count($survey['Question']))); ?></h2>
<div class="row">
	<div class="span12">
		<ul>
			<?php if (!empty($survey['Question'])): ?>
				<?php foreach ($survey['Question'] as $question): ?>
					<li>
						<?php echo $this->Html->link($question['Question']['label'], array('controller' => "Questions", 'action' => 'index', $survey['Survey']['id'], '#' => sprintf('q-coll-%d', $question['Question']['id']))); ?>
						(<?php echo @$question['ConcreteQuestion']->name; ?>)
					</li>
				<?php endforeach; ?>
			<?php else: ?>
				<p>
					<?php echo $this->TwitterBootstrap->button_link('<i class="icon-white icon-plus"></i> Add a Question', array('controller' => "Questions", 'action' => "add", $survey['Survey']['id']), array('style' => 'success', 'escape' => false, 'size' => 'small')); ?>
				</p>
			<?php endif; ?>
		</ul>
	</div>
</div>

<h2><?php echo sprintf("%d Survey %s", count($survey['SurveyResponse']), $this->Pluralization->smartPluralize("Response", count($survey['SurveyResponse']))); ?></h2>
<div class="row">
	<div class="span12">
		<?php echo $this->TwitterBootstrap->button_link('Summary', array('controller' => "SurveyResponses", 'action' => "summary", $survey['Survey']['id']), array('style' => 'success', 'escape' => false)); ?>
		<?php echo $this->TwitterBootstrap->button_link('Analytics', array('controller' => "SurveyResponses", 'action' => "analytics", $survey['Survey']['id']), array('style' => 'info', 'escape' => false)); ?>
	</div>
</div>
